<?php
/*
This sends a little bit of JSON to say if the user is logged in. 
*/

require_once( 'core.php' );
require_once( 'current_user_api.php' );

auth_ensure_user_authenticated( );
//helper_begin_long_process( );

$t_plugin_path = config_get( 'plugin_path' );
require_once( $t_plugin_path . 'DataRefine' . DIRECTORY_SEPARATOR . 'MetadataStandards.php' );
require_once( $t_plugin_path . 'DataRefine' . DIRECTORY_SEPARATOR . 'JSONstore.php' );

/*
$MetadataStandards = new MetadataStandards;
$MetadataStandards->saveMetadata();
*/
$JSONstore = new JSONstore;
$JSONstore->setDirectory("standards");
$standards = $JSONstore->read_parse_json("common-units");

$output = json_encode($standards, 1);

//now output for AJAX call from the Refine Login Screen
if(!isset($_GET["callback"])){
	header('Content-Type: application/json; charset=utf8');
	echo $output;
}
else{
	header('Content-Type: application/json; charset=utf8');
	$callback = $_GET["callback"];
	echo $callback."(".$output.");";
}


?>
